﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Steganograf
{
    public class Bit
    {
        public static void Replace(ref byte pByte, int pPos, byte pValue)
        {
            pByte = (byte)(pValue == 1 ? pByte | (1 << pPos) : pByte & ~(1 << pPos));
        }

        public static byte Extract(byte pByte, int pPos)
        {
            return (byte)((pByte & (1 << pPos)) >> pPos);
        }

    }
}
